var that
var list = []
Page({

  /**
   * 页面的初始数据
   */
  data: {
    multiIndex: [0, 0],
    multiArray: [["江苏","陕西"], ['南京','苏州','无锡','常州','淮安','连云港','南通','宿迁','泰州','徐州','盐城','扬州','镇江']],
    objectMultiArray:
    [{ "regid": "2", "parid": "1", "regname": "江苏", "regtype": "1", "ageid": "0" }, 
    { "regid": "3", "parid": "1", "regname": "陕西", "regtype": "1", "ageid": "0" },
    { "regid": "4", "parid": "2", "regname": "南京", "regtype": "2", "ageid": "0" }, 
    { "regid": "5", "parid": "2", "regname": "苏州", "regtype": "2", "ageid": "0" },         { "regid": "6", "parid": "2", "regname": "无锡", "regtype": "2", "ageid": "0" }, 
    { "regid": "7", "parid": "2", "regname": "常州", "regtype": "2", "ageid": "0" }, 
    { "regid": "8", "parid": "2", "regname": "淮安", "regtype": "2", "ageid": "0" }, 
    { "regid": "9", "parid": "2", "regname": "连云港", "regtype": "2", "ageid": "0" },
    { "regid": "10", "parid": "2", "regname": "南通", "regtype": "2", "ageid": "0" }, 
    { "regid": "11", "parid": "2", "regname": "宿迁", "regtype": "2", "ageid": "0" }, 
    { "regid": "12", "parid": "2", "regname": "泰州", "regtype": "2", "ageid": "0" }, 
    { "regid": "13", "parid": "2", "regname": "徐州", "regtype": "2", "ageid": "0" }, 
    { "regid": "14", "parid": "2", "regname": "盐城", "regtype": "2", "ageid": "0" },
    { "regid": "15", "parid": "2", "regname": "扬州", "regtype": "2", "ageid": "0" },
    { "regid": "16", "parid": "2", "regname": "镇江", "regtype": "2", "ageid": "0" },        { "regid": "17", "parid": "3", "regname": "西安", "regtype": "2", "ageid": "0" }, 
    { "regid": "18", "parid": "3", "regname": "安康", "regtype": "2", "ageid": "0" },        { "regid": "19", "parid": "3", "regname": "宝鸡", "regtype": "2", "ageid": "0" },
    { "regid": "20", "parid": "3", "regname": "汉中", "regtype": "2", "ageid": "0" },
    { "regid": "21", "parid": "3", "regname": "商洛", "regtype": "2", "ageid": "0" },
    { "regid": "22", "parid": "3", "regname": "铜川", "regtype": "2", "ageid": "0" },
    { "regid": "23", "parid": "3", "regname": "渭南", "regtype": "2", "ageid": "0" },
    { "regid": "24", "parid": "3", "regname": "咸阳", "regtype": "2", "ageid": "0" },
    { "regid": "25", "parid": "3", "regname": "延安", "regtype": "2", "ageid": "0" },
    { "regid": "26", "parid": "3", "regname": "榆林", "regtype": "2", "ageid": "0" }]
  },
  onLoad: function () {
    that = this
  },
  bindMultiPickerChange: function (e) {
    that.setData({
      "multiIndex[0]": e.detail.value[0],
      "multiIndex[1]": e.detail.value[1]
    })
  },
  bindMultiPickerColumnChange: function (e) {
    switch (e.detail.column) {
      case 0:
        list = []
        for (var i = 0; i < that.data.objectMultiArray.length; i++) {
          if (that.data.objectMultiArray[i].parid == that.data.objectMultiArray[e.detail.value].regid) {
            list.push(that.data.objectMultiArray[i].regname)
          }
        }
        that.setData({
          "multiArray[1]": list,
          "multiIndex[0]": e.detail.value,
          "multiIndex[1]": 0
        })

    }
  }

})